<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第 22 题</title>
    <script type="text/javascript">
        /*
            22、用户输入一个数字n
        */
        setTimeout(function () {
            // 用户输入
            var oInput1 = parseInt(prompt("请输入一个数字", "10"));

            // 创建累加器
            var oNum1 = 0;

            // 创建循环
            for (var n = 2; n <= oInput1; n++) {
                oNum1 += ((n + 1) / n);
            }

            // 输出至后台
            console.log(oNum1);
        }, 0)
    </script>
</head>

<body>

</body>

</html>